
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>spring session mybatis demo</title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
  <link href="http://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet">
  <link href="http://cdn.bootcss.com/datatables/1.10.13/css/jquery.dataTables.min.css" rel="stylesheet">
  <link href="http://cdn.bootcss.com/datatables/1.10.13/css/dataTables.bootstrap.min.css" rel="stylesheet">
  <script src="http://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
</head>
<body>
<h1>
  欢迎用户 <%=session.getAttribute("nickname")%>
</h1>
<div>
您可以<a href="<%=request.getContextPath()%>/logout">登出</a>
</div>
<div>
  <table id="m_grid" class="table table-stripped">
    <thead>
    <tr><th>ID</th><th>NO</th><th>说明</th><th>操作</th></tr>
    </thead>
    <tbody></tbody>
  </table>
</div>

<script src="http://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="http://cdn.bootcss.com/datatables/1.10.13/js/jquery.dataTables.min.js"></script>
<script src="http://cdn.bootcss.com/datatables/1.10.13/js/dataTables.bootstrap.min.js"></script>
<script>
  var msg_zh_cn={
    sProcessing: "处理中...",
    sLengthMenu: "显示 _MENU_ 项结果",
    sZeroRecords: "没有匹配结果",
    sInfo: "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
    sInfoEmpty: "显示第 0 至 0 项结果，共 0 项",
    sInfoFiltered: "(由 _MAX_ 项结果过滤)",
    sInfoPostFix: "",
    sSearch: "搜索:",
    sUrl: "",
    sEmptyTable: "表中数据为空",
    sLoadingRecords: "载入中...",
    sInfoThousands: ",",
    oPaginate: {
      sFirst: "首页",
      sPrevious: "上页",
      sNext: "下页",
      sLast: "末页"
    },
    oAria: {
      sSortAscending: ": 以升序排列此列",
      sSortDescending: ": 以降序排列此列"
    }
  };
  var tableOpts = {
    "language": msg_zh_cn,
    "serverSide": true,
//      "stateSave": true,
    "searching": false,
    "ordering" : false,
    'paging': true,
    'pageType':'input'
    // "dom": 'lpfrtip'
  };
  function initDataTable(target, options) {
    var merged = $.extend({},tableOpts, options);
//      console.log(merged);
    return $(target).dataTable(merged);
  }
$(function() {
  initDataTable('#m_grid',{
    "columns":[
      {"data":"id"},
      {"data":"no"},
      {"data":"remark"},
      {"data":"id"}
    ],
    "columnDefs":[
      {"render":function(data,type,row){
        var str='编辑';
        return str;
      },width:170,"targets":[3]}
    ]
    ,
    ajax:{
      url: "<%=request.getContextPath()%>/device/aj_grid"}
    ,dom: 'Bfrtip'
    <%--,buttons:[{--%>
      <%--text: '新建',--%>
      <%--action: function ( e, dt, node, config ) {--%>
        <%--location.href="${ctx}/system/user/add"--%>
      <%--}--%>
    <%--}]--%>
  })
})
</script>
</body>
</html>
